package com.gpay.erp.services.system.impl;


import java.util.List;

import javax.annotation.Resource;

import com.gpay.erp.core.dao.BaseDao;
import com.gpay.erp.core.dao.page.PagerModel;
import com.gpay.erp.services.system.BankcardInteface;
import com.gpay.erp.services.system.BasicInfoInteface;

import org.springframework.stereotype.Service;

/**
 * 用户业务逻辑实现类
 * 
 * @author lg
 * 
 */
@Service
public class BasicInfoService  implements BasicInfoInteface{
	 @Resource
		private BaseDao dao;

		public void setDao(BaseDao dao) {
			this.dao = dao;
		}

	public int insert(PagerModel e) {
		return dao.insert("basic.addOriginType", e);
	}
	public int insertGoods(PagerModel e) {
		return dao.insert("basic.addGoodsType", e);
	}

	public int delete(PagerModel e) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int deletes(String[] ids) {
		int length=0;
		for(String id:ids)
		{
			/*int flag=dao.delete("basic.deleteOriginById", id);//直接删除数据库数据*/
			int flag=dao.delete("basic.updateOriginByState", id);//修改数据状态，让其不在页面显示
			length=flag+length;
		}
		if(length==ids.length)
		{
			return 1;
		}
		return 0;
	}

	public int update(PagerModel e) {
		return dao.update("basic.originTypeUpdate", e);
	}
	public int updateGoods(PagerModel e) {
		return dao.update("basic.goodsTypeUpdate", e);
	}

	public PagerModel selectOne(PagerModel e) {
		return (PagerModel) dao.selectOne("basic.goodsTypeSelectOneNew", e);
	}

	public PagerModel selectById(String id) {
		return (PagerModel) dao.selectOne("basic.originTypeSelectOneNew", id);
	}

	/* 分页查询数据 */
	public PagerModel selectPageList(PagerModel e) {
		return dao.selectPageList("basic.originTypePageList", "basic.originTypedataTotal", e);
	}
	public PagerModel selectPageList1(PagerModel e) {
		return dao.selectPageList("basic.goodsTypePageList", "basic.goodsTypedataTotal", e);
	}
	
	
	public List selectList(PagerModel e) {
		return dao.selectList("basic.goodsQueryATree");
	}
  
}
